Optimal. Leaf size=50 \[ \frac {x}{a-b}-\frac {\sqrt {b} \text {ArcTan}\left (\frac {\sqrt {b} \tan (e+f x)}{\sqrt {a}}\right )}{\sqrt {a} (a-b) f} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.05, antiderivative size = 50, normalized size of antiderivative = 1.00, number of steps
used = 3, number of rules used = 3, integrand size = 14, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.214, Rules used = {3741, 3756,
211} \begin {gather*} \frac {x}{a-b}-\frac {\sqrt {b} \text {ArcTan}\left (\frac {\sqrt {b} \tan (e+f x)}{\sqrt {a}}\right )}{\sqrt {a} f (a-b)} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 211
Rule 3741
Rule 3756
Rubi steps
\begin {align*} \int \frac {1}{a+b \tan ^2(e+f x)} \, dx &=\frac {x}{a-b}-\frac {b \int \frac {\sec ^2(e+f x)}{a+b \tan ^2(e+f x)} \, dx}{a-b}\\ &=\frac {x}{a-b}-\frac {b \text {Subst}\left (\int \frac {1}{a+b x^2} \, dx,x,\tan (e+f x)\right )}{(a-b) f}\\ &=\frac {x}{a-b}-\frac {\sqrt {b} \tan ^{-1}\left (\frac {\sqrt {b} \tan (e+f x)}{\sqrt {a}}\right )}{\sqrt {a} (a-b) f}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.03, size = 49, normalized size = 0.98 \begin {gather*} \frac {\text {ArcTan}(\tan (e+f x))-\frac {\sqrt {b} \text {ArcTan}\left (\frac {\sqrt {b} \tan (e+f x)}{\sqrt {a}}\right )}{\sqrt {a}}}{a f-b f} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.00, size = 50, normalized size = 1.00
method | result | size |
derivativedivides | \(\frac {\frac {\arctan \left (\tan \left (f x +e \right )\right )}{a -b}-\frac {b \arctan \left (\frac {b \tan \left (f x +e \right )}{\sqrt {a b}}\right )}{\left (a -b \right ) \sqrt {a b}}}{f}\) | \(50\) |
default | \(\frac {\frac {\arctan \left (\tan \left (f x +e \right )\right )}{a -b}-\frac {b \arctan \left (\frac {b \tan \left (f x +e \right )}{\sqrt {a b}}\right )}{\left (a -b \right ) \sqrt {a b}}}{f}\) | \(50\) |
risch | \(\frac {x}{a -b}+\frac {\sqrt {-a b}\, \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+\frac {2 i \sqrt {-a b}+a +b}{a -b}\right )}{2 a \left (a -b \right ) f}-\frac {\sqrt {-a b}\, \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {2 i \sqrt {-a b}-a -b}{a -b}\right )}{2 a \left (a -b \right ) f}\) | \(120\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.49, size = 50, normalized size = 1.00 \begin {gather*} -\frac {\frac {b \arctan \left (\frac {b \tan \left (f x + e\right )}{\sqrt {a b}}\right )}{\sqrt {a b} {\left (a - b\right )}} - \frac {f x + e}{a - b}}{f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 2.78, size = 190, normalized size = 3.80 \begin {gather*} \left [\frac {4 \, f x - \sqrt {-\frac {b}{a}} \log \left (\frac {b^{2} \tan \left (f x + e\right )^{4} - 6 \, a b \tan \left (f x + e\right )^{2} + a^{2} + 4 \, {\left (a b \tan \left (f x + e\right )^{3} - a^{2} \tan \left (f x + e\right )\right )} \sqrt {-\frac {b}{a}}}{b^{2} \tan \left (f x + e\right )^{4} + 2 \, a b \tan \left (f x + e\right )^{2} + a^{2}}\right )}{4 \, {\left (a - b\right )} f}, \frac {2 \, f x - \sqrt {\frac {b}{a}} \arctan \left (\frac {{\left (b \tan \left (f x + e\right )^{2} - a\right )} \sqrt {\frac {b}{a}}}{2 \, b \tan \left (f x + e\right )}\right )}{2 \, {\left (a - b\right )} f}\right ] \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 240 vs.
\(2 (37) = 74\).
time = 1.23, size = 240, normalized size = 4.80 \begin {gather*} \begin {cases} \frac {\tilde {\infty } x}{\tan ^{2}{\left (e \right )}} & \text {for}\: a = 0 \wedge b = 0 \wedge f = 0 \\\frac {- x - \frac {1}{f \tan {\left (e + f x \right )}}}{b} & \text {for}\: a = 0 \\\frac {f x \tan ^{2}{\left (e + f x \right )}}{2 b f \tan ^{2}{\left (e + f x \right )} + 2 b f} + \frac {f x}{2 b f \tan ^{2}{\left (e + f x \right )} + 2 b f} + \frac {\tan {\left (e + f x \right )}}{2 b f \tan ^{2}{\left (e + f x \right )} + 2 b f} & \text {for}\: a = b \\\frac {x}{a + b \tan ^{2}{\left (e \right )}} & \text {for}\: f = 0 \\\frac {x}{a} & \text {for}\: b = 0 \\\frac {2 f x \sqrt {- \frac {a}{b}}}{2 a f \sqrt {- \frac {a}{b}} - 2 b f \sqrt {- \frac {a}{b}}} - \frac {\log {\left (- \sqrt {- \frac {a}{b}} + \tan {\left (e + f x \right )} \right )}}{2 a f \sqrt {- \frac {a}{b}} - 2 b f \sqrt {- \frac {a}{b}}} + \frac {\log {\left (\sqrt {- \frac {a}{b}} + \tan {\left (e + f x \right )} \right )}}{2 a f \sqrt {- \frac {a}{b}} - 2 b f \sqrt {- \frac {a}{b}}} & \text {otherwise} \end {cases} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.55, size = 68, normalized size = 1.36 \begin {gather*} -\frac {\frac {{\left (\pi \left \lfloor \frac {f x + e}{\pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (b\right ) + \arctan \left (\frac {b \tan \left (f x + e\right )}{\sqrt {a b}}\right )\right )} b}{\sqrt {a b} {\left (a - b\right )}} - \frac {f x + e}{a - b}}{f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 12.30, size = 948, normalized size = 18.96 \begin {gather*} -\frac {\mathrm {atan}\left (\frac {\frac {-4\,b^3\,\mathrm {tan}\left (e+f\,x\right )+\frac {\left (4\,b^4-8\,a\,b^3+4\,a^2\,b^2+\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (-8\,a^3\,b^2+8\,a^2\,b^3+8\,a\,b^4-8\,b^5\right )\,1{}\mathrm {i}}{2\,a-2\,b}\right )\,1{}\mathrm {i}}{2\,a-2\,b}}{2\,a-2\,b}+\frac {-4\,b^3\,\mathrm {tan}\left (e+f\,x\right )+\frac {\left (8\,a\,b^3-4\,b^4-4\,a^2\,b^2+\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (-8\,a^3\,b^2+8\,a^2\,b^3+8\,a\,b^4-8\,b^5\right )\,1{}\mathrm {i}}{2\,a-2\,b}\right )\,1{}\mathrm {i}}{2\,a-2\,b}}{2\,a-2\,b}}{\frac {\left (-4\,b^3\,\mathrm {tan}\left (e+f\,x\right )+\frac {\left (4\,b^4-8\,a\,b^3+4\,a^2\,b^2+\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (-8\,a^3\,b^2+8\,a^2\,b^3+8\,a\,b^4-8\,b^5\right )\,1{}\mathrm {i}}{2\,a-2\,b}\right )\,1{}\mathrm {i}}{2\,a-2\,b}\right )\,1{}\mathrm {i}}{2\,a-2\,b}-\frac {\left (-4\,b^3\,\mathrm {tan}\left (e+f\,x\right )+\frac {\left (8\,a\,b^3-4\,b^4-4\,a^2\,b^2+\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (-8\,a^3\,b^2+8\,a^2\,b^3+8\,a\,b^4-8\,b^5\right )\,1{}\mathrm {i}}{2\,a-2\,b}\right )\,1{}\mathrm {i}}{2\,a-2\,b}\right )\,1{}\mathrm {i}}{2\,a-2\,b}}\right )}{f\,\left (a-b\right )}+\frac {\mathrm {atan}\left (\frac {\frac {\sqrt {-a\,b}\,\left (2\,b^3\,\mathrm {tan}\left (e+f\,x\right )-\frac {\sqrt {-a\,b}\,\left (2\,b^4-4\,a\,b^3+2\,a^2\,b^2+\frac {\mathrm {tan}\left (e+f\,x\right )\,\sqrt {-a\,b}\,\left (-8\,a^3\,b^2+8\,a^2\,b^3+8\,a\,b^4-8\,b^5\right )}{4\,\left (a\,b-a^2\right )}\right )}{2\,\left (a\,b-a^2\right )}\right )\,1{}\mathrm {i}}{a\,b-a^2}+\frac {\sqrt {-a\,b}\,\left (2\,b^3\,\mathrm {tan}\left (e+f\,x\right )-\frac {\sqrt {-a\,b}\,\left (4\,a\,b^3-2\,b^4-2\,a^2\,b^2+\frac {\mathrm {tan}\left (e+f\,x\right )\,\sqrt {-a\,b}\,\left (-8\,a^3\,b^2+8\,a^2\,b^3+8\,a\,b^4-8\,b^5\right )}{4\,\left (a\,b-a^2\right )}\right )}{2\,\left (a\,b-a^2\right )}\right )\,1{}\mathrm {i}}{a\,b-a^2}}{\frac {\sqrt {-a\,b}\,\left (2\,b^3\,\mathrm {tan}\left (e+f\,x\right )-\frac {\sqrt {-a\,b}\,\left (2\,b^4-4\,a\,b^3+2\,a^2\,b^2+\frac {\mathrm {tan}\left (e+f\,x\right )\,\sqrt {-a\,b}\,\left (-8\,a^3\,b^2+8\,a^2\,b^3+8\,a\,b^4-8\,b^5\right )}{4\,\left (a\,b-a^2\right )}\right )}{2\,\left (a\,b-a^2\right )}\right )}{a\,b-a^2}-\frac {\sqrt {-a\,b}\,\left (2\,b^3\,\mathrm {tan}\left (e+f\,x\right )-\frac {\sqrt {-a\,b}\,\left (4\,a\,b^3-2\,b^4-2\,a^2\,b^2+\frac {\mathrm {tan}\left (e+f\,x\right )\,\sqrt {-a\,b}\,\left (-8\,a^3\,b^2+8\,a^2\,b^3+8\,a\,b^4-8\,b^5\right )}{4\,\left (a\,b-a^2\right )}\right )}{2\,\left (a\,b-a^2\right )}\right )}{a\,b-a^2}}\right )\,\sqrt {-a\,b}\,1{}\mathrm {i}}{a\,f\,\left (a-b\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________